<template>
  <div id="goodsall" class="modifygoods">
    <el-row>
      <el-col :span="24">
        <div class="modifywrap">
          <div class="panel">
            <div class="panel-header">
              <h3 class="title">商品修改<el-button type="primary" class="fr postbtn">发布商品</el-button></h3>
            </div> 
            <div class="goodsdetail-item">
              <span class="label">商品名称:</span>
              <el-input
                type="textarea"
                autosize
                placeholder="请输入内容"
                v-model="productInfo.name">
              </el-input>
            </div>
            <div class="goodsdetail-item">
              <span class="label">商品描述:</span>
              <el-input
                type="textarea"
                autosize
                placeholder="请输入内容"
                v-model="productInfo.subtitle">
              </el-input>
            </div>
            <div class="goodsdetail-item">
              <span class="label">商品分类:</span>
              <el-select v-model="select" slot="prepend" placeholder="请选择">
                <el-option label="餐厅名" value="1"></el-option>
                <el-option label="订单号" value="2"></el-option>
                <el-option label="用户电话" value="3"></el-option>
              </el-select>
            </div>
            <div class="goodsdetail-item">
              <span class="label">商品价格:</span>
              <el-input placeholder="请输入内容" v-model="productInfo.price">
                <template slot="append">元</template>
              </el-input>
            </div>
            <div class="goodsdetail-item">
              <span class="label">商品库存:</span>
              <el-input placeholder="请输入内容" v-model="productInfo.stock">
                <template slot="append">元</template>
              </el-input>
            </div>
            <div class="goodsdetail-item ovh">
              <span class="label">商品图片:</span>
              <a class="addmainImage">+</a>
            </div>
            <div class="goodsdetail-item ovh">
              <span class="label">商品详情:</span>
              <div  class="editor"><editor></editor></div>
              
             <!--  <div class="editor" v-html="productInfo.detail"></div> -->
            </div>
            <div class="goodsdetail-item ovh">
              <span class="label f0">商品详情:</span>
              <el-button type="primary">发布商品</el-button>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import axios from 'axios'
  import editor from '../../common/editorView'
  export default{
    name: 'newsForm',
    data () {
      return {
        productInfo: '',
        select: ''
      }
    },
    components: {
      editor: editor
    },
    created () {
      console.log(this.$route.params)
      axios({
          url: 'http://47.90.38.178:8080/wx_shop_test/manage/product/detail.do',
          method: 'POST',
          params: {
            productId: this.$route.params.id
          }
        }).then(obj => {
          if (obj.data.status === 0) {
            console.log('x')
            this.productInfo = obj.data.data
            console.log(obj.data.list)
          }
        })
    },
    methods: {
      contactUrl (host, str) {
        return host + str
      },
      modify () {

      }
    }
  }
</script>
<style>
.modifygoods{
  background: #fff;
}
  .goodsdetail-item{
    margin-top: 20px;
    text-align: left;
  }
  .goodsdetail-item .label{
    float: left;
    width: 120px;
    text-align: right;
    line-height: 33px;
    font-weight:bold;
    margin-right: 12px;
  }
  .goodsdetail-item .el-textarea,.goodsdetail-item .el-input-group--append,.goodsdetail-item .el-select{
    width: 300px;
    max-width: calc(100% - 140px);
  }
  .addmainImage{
    width: 56px;
    height: 56px;
    border:3px solid #e8e8e8;
    font-size: 48px;
    line-height: 56px;
    color: #ccc;
    text-align: center;
    float: left;
    cursor: pointer;
  }
  .modifygoods .editor{
    margin-left: 132px;
  }
  .panel-header .postbtn{
    margin-top: -10px;
   }
</style>
